Skip to content

Feat DF-662: Handles a component that doesn't exist in plugin yet#274

Closed
jbarnsley10 wants to merge 1 commit intomainfrom
feat/DF-662-new-component
Closed

Feat DF-662: Handles a component that doesn't exist in plugin yet#274
jbarnsley10 wants to merge 1 commit intomainfrom
feat/DF-662-new-component

Conversation

@jbarnsley10
Copy link
Copy Markdown
Contributor

@jbarnsley10 jbarnsley10 commented Dec 2, 2025

Proposed change

A new component can be added with minimal effort.
In tandem with forms-designer PR DEFRA/forms-designer#1223

Jira ticket: DF-662

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Misc. (documentation, build updates, etc)

Checklist

  • You have executed this code locally and it performs as expected.
  • You have added tests to verify your code works.
  • You have added code comments and JSDoc, where appropriate.
  • There is no commented-out code.
  • You have added developer docs in README.md and docs/* (where appropriate, e.g. new features).
  • The tests are passing (npm run test).
  • The linting checks are passing (npm run lint).
  • The code has been formatted (npm run format).

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 2, 2025

default:
// @ts-expect-error - may be a type that isn't in ComponentType
logger.error(`Component type ${def.type} does not exist`)
component = new Components.TextField(def, options)
Copy link
Copy Markdown
Contributor

@alexluckett alexluckett Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right approach - it could result in components silently falling back on Text Fields if people aren't proactively monitoring logs.

As far as Designer goes, this could be viable style of approach. But the plugin shouldn't be capturing data if the component isn't valid.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. This call is used by the preview in designer so blows up if the component does not exist. I'll try to handle this silently in designer so we keep the runner able to throw the error here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing this as the designer now handles an invalid component

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@jbarnsley10 jbarnsley10 closed this Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants